added some development tools
[windows-sources.git] / developer / Samples / NET 4.6 / Samples for Parallel / AcmePizza / AcmePizza_CSharp / PizzaSizeCircle.xaml.cs
blobca3b106c2ff2cef8f4143c1db78eac4a4d0b7dcb
1 //--------------------------------------------------------------------------
2 //
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 //
5 // File: PizzaSizeCircle.xaml.cs
6 //
7 //--------------------------------------------------------------------------
9 using System;
10 using System.Windows;
11 using System.Windows.Controls;
13 namespace AcmePizza
15 /// <summary>
16 /// Interaction logic for PizzaSizeCircle.xaml
17 /// </summary>
18 public partial class PizzaSizeCircle : UserControl
21 public PizzaSizeCircle()
23 InitializeComponent();
26 public int PizzaSize
28 get
30 return (int)this.GetValue(PizzaSizeProperty);
32 set
34 this.SetValue(PizzaSizeProperty, value);
39 static void PizzaSizeChangedCallBack(DependencyObject property, DependencyPropertyChangedEventArgs args)
41 var control = (PizzaSizeCircle)property;
42 switch ((int)args.NewValue)
44 case 11:
45 control.circle.Width = 30;
46 control.circle.Height = 30;
47 control.layoutRoot.Width = 30;
48 control.layoutRoot.Height = 30;
49 control.label.Text = "11";
50 break;
51 case 13:
52 control.circle.Width = 50;
53 control.circle.Height = 50;
54 control.layoutRoot.Width = 50;
55 control.layoutRoot.Height = 50;
56 control.label.Text = "13";
57 break;
58 case 17:
59 control.circle.Width = 75;
60 control.circle.Height = 75;
61 control.layoutRoot.Width = 75;
62 control.layoutRoot.Height = 75;
63 control.label.Text = "17";
64 break;
65 default:
66 throw new ArgumentOutOfRangeException();
70 public static readonly DependencyProperty PizzaSizeProperty =
71 DependencyProperty.Register("PizzaSize", typeof(int), typeof(PizzaSizeCircle),
72 new UIPropertyMetadata(17, new PropertyChangedCallback(PizzaSizeChangedCallBack)));